package com.cskaoyan.service.impl;

import com.cskaoyan.mapper.MarketAdMapper;
import com.cskaoyan.model.MarketAd;
import com.cskaoyan.model.MarketAdExample;
import com.cskaoyan.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Pudding
 * @Date 2024/6/10 15:03
 */
@Service
public class AdServiceImpl implements AdService {
    @Autowired
    MarketAdMapper adMapper;

    @Override
    public List<MarketAd> query() {
        MarketAdExample example = new MarketAdExample();
        //1. 找出没有逻辑删除的记录
        example.createCriteria().andDeletedEqualTo(false);
        //2. 按照添加时间倒序查询
        example.setOrderByClause("add_time desc");
        //3. 进行条件查询
        List<MarketAd> marketAds = adMapper.selectByExample(example);

        return marketAds;
    }
}
